<?php
ini_set("display_errors", "On"); 
error_reporting(E_ALL | E_STRICT);
function micro_time()
{
    list($usec, $sec) = explode(" ", microtime());
    return ($usec * 1000000 + $sec * 1000000);
}

$ip   = "10.16.19.135";
$port = "3306";
$user = 'root';
$pass = '123456';
$db   = "test";

var_dump(2);
$conn = new mysqli($ip, $user, $pass, $db, $port);
if (mysqli_connect_errno($conn)) {
    echo "连接 MySQL 失败: " . mysqli_connect_error() . "\n";
}
$starttime = micro_time();

$name = 'cxy';
$sql = "select id, name from user where `name` = ? limit 1";
$stmt = $conn->prepare($sql);
$stmt->bind_param('s', $name);
$stmt->execute();
$stmt->bind_result($id, $name);
while ($stmt->fetch()) {
    echo "第" . $id . "条： " . $name . "<br>";
}

$conn->close();
